<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<!DOCTYPE html>
<head>
    <meta charset="utf-8">
    <title>增加车位页</title>
    <a href="${pageContext.request.contextPath}/Mmenu.html" style="color: #8032f5">管理员菜单</a>
    <a href="${pageContext.request.contextPath}/Mself.html" style="color: #8032f5"><span>用户名:${UserName}</span></a>
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <style>
        p{background-color:#e0ffff;}
    </style>
    <link rel="stylesheet" href="css/reset.css"><!--CSS RESET-->
    <link rel="stylesheet" href="css/demo.css">
    <link rel="stylesheet" href="src/css/dialog.css">
    <link rel="stylesheet" type="text/css" href="css/htmleaf-demo.css"><!--演示页面样式，使用时可以不引用-->
</head>
<body>
<form id="addLot" action="<c:url value="/addlot1.html"/>" method="post">
    <h2>请管理员增加车位</h2>
    <p>
        <label for="LotID">增加的车位号：</label>
        <input type="text"  id="LotID" name="LotID" placeholder="请输入要增加的车位号">
    </p>

    <div class="mt20"><button id="sendSuccessToTop">添加</button></div>
</form>
<table class="table table-hover col-sm-10">
    <h2>车位信息(1表示“是”，0表示“否”)</h2>
    <thead>
    <tr>
        <th>车位号(LotID)</th>
        <th>是否可用(IsEnable)</th>
        <th>是否为空(IsEmpty)</th>
        <th>是否预定(Predetermine)</th>
        <th>是否为VIP车位(ISVIPLot)</th>
    </tr>
    </thead>

    <c:forEach items="${lotinfos}" var="lotinfo">
        <tr>
            <td>${lotinfo.lotID}</td>
            <td>${lotinfo.isEnable}</td>
            <td>${lotinfo.isEmpty}</td>
            <td>${lotinfo.predetermine}</td>
            <td>${lotinfo.ISVIPLot}</td>

        </tr>
    </c:forEach>
</table>

<script src="js/jquery-1.11.0.min.js" type="text/javascript"></script>
<script src="src/jquery.dialog.js"></script>
<script>
    $(function () {
        $('button#sendSuccessToTop').click(function () {
            var postdata= $("#addLot").serialize();
            $.ajax({
                url:"Mmenu.html",
                async:false,
                cache:false,
                data:postdata,
                type:"POST",
                success:function () {
                    alert("如果操作成功页面就会跳转，操作失败就停留在原页面");
                },
                error:function () {
                    alert("未知错误");
                }
            });
        })
    })
</script>
</body>
</html>
